package io;

import java.io.*;

/*缓冲流:一对高级流,作用是加快读写效率*/
public class CopyDemo3Buffered {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("video.mp4");
        BufferedInputStream bis = new BufferedInputStream(fis);
        FileOutputStream fos = new FileOutputStream("copy.mp4");
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        int len;
        while ((len=bis.read())!=-1){
            bos.write(len);
        }
        bos.close();
        bis.close();
        /*        FileInputStream fis = new FileInputStream("video.mp4");
        BufferedInputStream bis = new BufferedInputStream(fis);
        FileOutputStream fos = new FileOutputStream("copy3.mp4");
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        int d;
        while ((d = bis.read()) != -1) {
            bos.write(d);
        }
        bos.close();
        bis.close();*/
    }
}
